package com.lbd.smsplatform.dao;

import com.lbd.smsplatform.bean.SmsLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import sun.reflect.generics.repository.AbstractRepository;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Created by wang on 2016/9/23.
 */
public interface SmsLogRepository extends PagingAndSortingRepository<SmsLog, Serializable>, JpaSpecificationExecutor<SmsLog> {
    List<SmsLog> findBySenderIp(String senderIp);

    List<SmsLog> findByRecipient(String recipient);

    List<SmsLog> findBySenderIpAndCreatedDateGreaterThan(String senderIp, Date createdDate);

    List<SmsLog> findByRecipientAndCreatedDateGreaterThan(String recipient, Date createdDate);

    List<SmsLog> findBySenderIpAndCreatedDateBetween(String senderIp, Date createdDateOld, Date createdDateNow);

    List<SmsLog> findByRecipientAndCreatedDateBetween(String recipient, Date createdDateOld, Date createdDateNow);

}
